/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.oimwrapper.testers;

import Thor.API.Operations.tcReconciliationOperationsIntf;
import com.thortech.util.logging.Logger;
import java.util.HashMap;
import java.util.Map;
import org.junit.Test;
import org.oimwrapper.connectors.OIMAdapterBase;
import org.oimwrapper.connectors.OIMRemoteClientBase;

/**
 *
 */
public class ClientReconTester extends ClientBaseTester {
    
    
    OIMRemoteClientBase remoteClient = null;
    OIMAdapterBase apiBase = null;
    tcReconciliationOperationsIntf reconOps = null;
    
    private static final Logger logger = Logger.getLogger(ClientReconTester.class.getName());
    
    @Test
    public void mainTest()
    {
        try
        {
            remoteClient = connect();
            apiBase = remoteClient.getUtils();
            reconOps = (tcReconciliationOperationsIntf)apiBase.getUtility(Thor.API.Operations.tcReconciliationOperationsIntf.class);
        }
        catch(Exception e)
        {
            logger.error("Connection Error",e);
            return;
        }
        
        try
        {
            Map reconMap = new HashMap();
            reconMap.put("UserID","bb12781");  // cc10889
            Map groupMap = new HashMap();
            groupMap.put("GROUPNAME","Group2");
            long reconEvent = reconOps.createReconciliationEvent("Resource B", reconMap, false);
            long pk2 = reconOps.addMultiAttributeData(reconEvent, "GROUPS", groupMap);
            
            reconOps.providingAllMultiAttributeData(reconEvent,"GROUPS",true);
            reconOps.finishReconciliationEvent(reconEvent);
            reconOps.processReconciliationEvent(reconEvent);
            logger.debug("Event ID:" + reconEvent);
        }
        catch(Exception e)
        {
            logger.error("Process Error",e);
            return;
        }
        logger.debug("Recon Complete");
    }

}
